{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=355
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	i,j,n,kk:longint;
	a:array[0..1010,0..1010] of longint;
	f:boolean;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
fillchar(a,sizeof(a),0);
read(n);
for i:=1 to n do
	for j:=1 to n do read(a[i][j]);
f:=true;
kk:=n div 2;
for i:=1 to n do begin
	for j:=1 to n do
		if a[i][j]<>a[j][i] then begin
			f:=false;
			break;
		end;
	if not f then break;
end;
if f then write('yes') else write('no');
end.